package business;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import service.myservice.login.LoginService;
import service.myservice.login.LoginServiceImpl;
import service.vo.MessageVO;
import struts.action.Action;
import struts.form.ActionForm;
import struts.form.XmlBean;

public class LoginAction implements Action {

	@Override
	public String execute(HttpServletRequest request, ActionForm form, Map<String, String> actionForward) {
		String url = "fail";
		LoginForm loginForm = (LoginForm) form;
		if (loginForm.getUsername().equals("kyle") && loginForm.getPassword().equals("123456")) {
			url = "sucess";
		}
		// LoginService loginService = new LoginServiceImpl();
		// Map<String, MessageVO> map =
		// loginService.getVMessageVO(request.getParameter("text"));
		//
		// Set<String> set = map.keySet();
		// for (Iterator<String> it = set.iterator(); it.hasNext();) {
		// url = it.next();
		// request.setAttribute("mess", map.get(url));
		// }
		return actionForward.get(url);
	}

}
